﻿using System;
using System.ComponentModel.DataAnnotations;

namespace Ch12.Models
{
    //
    // 摘要:
    //     Entity Framework custom base entity
    public abstract class EntitySet
    {
        //
        // 摘要:
        //     primary key, string type of guid value
        [Key]
        [MaxLength(36)]
        public string Id { get; set; }
        //
        // 摘要:
        //     built-in field, string type of State value
        [Required]
        public DataState State { get; set; }
        //
        // 摘要:
        //     nullable built-in field, DateTimeOffset type of CreatedOn value
        public DateTimeOffset? CreatedOn { get; set; }
        //
        // 摘要:
        //     nullable built-in field, string type of CreatedBy value, can be a user id which
        //     is a foreign key or not
        [MaxLength(36)]
        public string CreatedBy { get; set; }
        //
        // 摘要:
        //     nullable built-in field, string type of ModifiedOn value, ConcurrencyCheck and
        //     last modified time field
        [ConcurrencyCheck]
        [MaxLength(36)]
        public string ModifiedOn { get; set; }
        //
        // 摘要:
        //     nullable built-in field, string type of ModifiedBy value, can be a user id which
        //     is a foreign key or not
        [MaxLength(36)]
        public string ModifiedBy { get; set; }
    }
}
